home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFBIND / AESFAST.SH < prev    next >
Text File  |  1992-03-09  |  6KB  |  125 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* AESFAST Public Domain AES bindings.
  5. ;*
  6. ;*  Maintenance:
  7. ;*   02/10/89 v1.10 - Added more labels to items within global array.
  8. ;*========================================================================
  9.  
  10. ;*************************************************************************
  11. ;*
  12. ;* Header file for AESFAST source code modules.  Offsets (structures)
  13. ;*  and macros can be found here. (Hey!  just like a C header...)
  14. ;*
  15. ;*  Also, if the symbol AES_ALLOCBSS is defined, we will actually 
  16. ;*  allocate storage in the BSS section for the AES control blocks, if
  17. ;*  the symbol is not defined, we just define the offsets but no storage.
  18. ;*
  19. ;*************************************************************************
  20.  
  21.           .globl    aesblock    ; Everybody (potentially at least)
  22.           .globl    aes_call    ; uses these things, so we might
  23.           .globl    aes_do      ; as well define them here.
  24.  
  25. FALSE     = 0                   ; Mundane
  26. TRUE      = 1                   ; stuff.
  27.  
  28. RET2USER  = 0                   ; These are flags used by the ACall macro to
  29. RET2HERE  = 1                   ; decide between calling aes_call or aes_do.
  30.  
  31. ;-------------------------------------------------------------------------
  32. ; ACall macro.  Call the AES.  Depending on the value of the 'type' flag,
  33. ;  we generate a 'jsr aes_call' or a 'jmp aes_do'.
  34. ;-------------------------------------------------------------------------
  35.  
  36. .macro    ACall     type
  37.           .if    \type
  38.            jsr      aes_call
  39.           .else
  40.            jmp      aes_do
  41.           .endif
  42. .endm
  43.  
  44. ;-------------------------------------------------------------------------
  45. ; AControl macro.  Load register d0 with the control array (byte) values.
  46. ;  By getting all the control values into a single register (except the
  47. ;  'addrout' count, which is always zero) we can load the entire control
  48. ;  array with a single 'movep.l' instruction in aes_call.
  49. ;-------------------------------------------------------------------------
  50.  
  51. .macro    AControl  fun,ini,adi,ino
  52.           move.l    #( (\fun << 24) | (\ini << 16) | (\adi << 8) | \ino ),d0
  53. .endm
  54.  
  55. ;-------------------------------------------------------------------------
  56. ; Define the offsets within the AES block storage area.
  57. ;-------------------------------------------------------------------------
  58.  
  59.           .abs                          ; Offsets from 'aesblock'...
  60.  
  61. aespb     =         *                   ; 'aespb' MUST be first!...
  62. pcontrl:  ds.l      1                   ;   Pointer to control array
  63. pglobal:  ds.l      1                   ;   Pointer to global array
  64. pintin:   ds.l      1                   ;   Pointer to intin array
  65. pintout:  ds.l      1                   ;   Pointer to intout array
  66. padrin:   ds.l      1                   ;   Pointer to adrin array
  67. padrout:  ds.l      1                   ;   Pointer to adrout array
  68.  
  69. control   =         *                   ; Control array is next...
  70. function: ds.w      1                   ;   Function code
  71. sintin:   ds.w      1                   ;   size of intin
  72. sintout:  ds.w      1                   ;   size of intout
  73. sadrin:   ds.w      1                   ;   size of adrin
  74. sadrout:  ds.w      1                   ;   size of adrout
  75.  
  76. global:   ds.w      15                  ; Global array, needs no further def.
  77.  
  78. SZ_AESBLK =         *                   ; Size of the aesblock storage.
  79.  
  80. ;-------------------------------------------------------------------------
  81. ; If we are supposed to be allocating the BSS storage (eg, if we are
  82. ;  being included from AESCOMN), export the global labels and define
  83. ;  the necessary BSS storage.
  84. ;
  85. ;  |1.1:  Fully defined the global storage block and exported the labels
  86. ;         for all of it. Names were made up using 'gl_apid' as the example.
  87. ;         This change is primarily to support TOS 1.4, in which the AES
  88. ;         version becomes an important issue.
  89. ;-------------------------------------------------------------------------
  90.  
  91.           .globl    _gl_apid            ; Export this label for C programs.
  92.           .globl    _global             ; Export this label for C programs.
  93.           .globl    _aespb              ; Export this label for C programs.
  94.           .globl    _aescontrol         ; |v1.1: added
  95.           .globl    _gl_apversion       ; |v1.1: added
  96.           .globl    _gl_apcount         ; |v1.1: added
  97.           .globl    _gl_apid            ; |v1.1: added
  98.           .globl    _gl_apprivate       ; |v1.1: added
  99.           .globl    _gl_apptree         ; |v1.1: added
  100.           .globl    _gl_ap1resv         ; |v1.1: added
  101.           .globl    _gl_apprshdr        ; |v1.8: added
  102.           .globl    _gl_ap2resv         ; |v1.8: added
  103.           
  104.           .if       ^^defined AES_ALLOCBSS
  105.           .bss
  106. aesblock:                               ; Integrated AES data block storage.
  107. _aespb:        ds.l      6              ;   Room for aespb array.
  108. _aescontrol:   ds.w      5              ;   Room for control array.
  109. _global:                                ;   Global array...
  110. _gl_apversion: ds.w      1              ;       AES version.
  111. _gl_apcount:   ds.w      1              ;       AES max appl count.
  112. _gl_apid:      ds.w      1              ;       Application id.
  113. _gl_apprivate: ds.l      1              ;       Application-specific data.
  114. _gl_apptree:   ds.l      1              ;       Pointer to head of RSC tree.
  115. _gl_ap1resv:                            ;|v1.4: (Old name retained)
  116. _gl_aprshdr:   ds.l      1              ;|v1.4: Pointer to rshdr struct.
  117. _gl_ap2resv:   ds.l      3              ;       Rest of the global array.
  118.  
  119.           .endif ; ^^defined AES_ALLOCBSS
  120.  
  121.           .text                         ; Leave BSS mode...
  122.  
  123. ;         end of code
  124.  
  125.